package com.flying.scorer.score.equity.marketdata;

import com.flying.refdata.model.equity.EquityInfo;
import com.flying.refdata.model.equity.MarketData;
import com.flying.refdata.service.MarketDataService;
import com.flying.scorer.score.ScoreException;
import com.flying.scorer.score.equity.AbstractEquityScorer;
import com.flying.utils.bean.BeanUtil;


public abstract class AbstractMarketDataScorer extends AbstractEquityScorer {
    private MarketDataService service;

    public AbstractMarketDataScorer(MarketDataService service) {
        this.service = service;
    }

    MarketData getMarketData(EquityInfo info, int date) throws ScoreException {
        MarketData md = service.getMarketData(info, date);
        if (md == null)
            throw new ScoreException("Can't find the market data. date:" + date + "equity info:" + BeanUtil.describe(info));
        return md;
    }
}
